class Machine
  include Mongoid::Document
  include Mongoid::Timestamps

  field :code, type: String
  field :name, type: String
  field :location, type: Array
  field :position, type: String
  field :cell_num, type: Integer
  field :memo, type: String

  has_many :machine_grids

  validates :code, :name, :position, :cell_num, :memo, presence: true
  validates :code, uniqueness: true
end
